Repository navigation
test(loop): cover run() wiring of gate_result events - #3611
Merged
Merged
Conversation
Closes #3599. tests/test_gate_timings.py drives execute_unit_attempt(), build_attempt_gate_events() and build_phase_gate_events() directly, so a refactor that dropped run()'s calls to them would leave every test green while `specfuse stats` silently reported "not recorded" or stale results. tests/test_run_gate_result_wiring.py runs run() end to end on a temporary feature with a stubbed agent and real gate commands: attempt 1 fails a gate (triggering the retroactive baseline probe), attempt 2 bills zero tokens (no verify), attempt 3 passes, and the close triggers the broad run. It asserts events.jsonl holds attempt-phase gate_result events for attempts 1 and 3 only, baseline-phase events after the failed attempt, and broad-phase events after the broad run. Tests: - tests/test_run_gate_result_wiring.py:RunGateResultWiringTest — 4 tests; removing each of the four wiring points in run() fails exactly one of them. Verification: - scripts/smoke-test.sh: 5118 tests OK (skipped=4) Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Closes #3599.
Root cause
tests/test_gate_timings.pyexercisesexecute_unit_attempt(),build_attempt_gate_events()andbuild_phase_gate_events()directly. Nothing tested thatrun()calls them. If a refactor dropped one of the four wiring points, every test would still pass, andspecfuse statswould quietly report "not recorded", or stale results from an earlier attempt. The four wiring points:wu.last_gate_results;gate_resultextend;phase: baselineextend on the retroactive attribution path;phase: broadextend after the gate's broad run.Fix
This is a test-only change; no production code changes.
tests/test_run_gate_result_wiring.pyrunsrun()end to end on a temporary feature. The agent is stubbed, and the gates are real commands:test ! -f broken.flagandsleep 0.1. The run goes:verify()never runs.Tests
RunGateResultWiringTest, which has 4 tests, asserts thatevents.jsonlholds:phase: attemptgate_resultper gate for attempts 1 and 3, with the right attempt numbers, and none for attempt 2;phase: baselineevents after the failed attempt;phase: broadevents after the broad run.Red evidence. I removed each wiring point in
run()one at a time, then restored it. Each removal fails exactly one test:wu.last_gate_results = []resettest_attempt_phase_one_per_gate_per_verified_attempt(attempt 2 carries attempt 1's results)gate_resultextendtest_attempt_phase_one_per_gate_per_verified_attempttest_baseline_phase_after_failed_attempttest_broad_phase_after_broad_runVerification
scripts/smoke-test.sh: 5118 tests OK (skipped=4).ruffis clean.🤖 Generated with Claude Code